﻿// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证（版本 2.0）进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！
using Magicodes.ExporterAndImporter.Core;
namespace Admin.NET.Application;

/// <summary>
/// 区域预算配置表输出参数
/// </summary>
public class StoreBudgetConfigOutput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    public long Id { get; set; }    
    
    /// <summary>
    /// 区域ID
    /// </summary>
    public long OrgsId { get; set; }    
    
    /// <summary>
    /// 区域ID 描述
    /// </summary>
    public string OrgsFkDisplayName { get; set; } 
    
    /// <summary>
    /// 预算开始时间
    /// </summary>
    public DateTime StartDate { get; set; }    
    
    /// <summary>
    /// 预算结束时间
    /// </summary>
    public DateTime EndDate { get; set; }    
    
    /// <summary>
    /// 总预算额度
    /// </summary>
    public decimal TotalAmount { get; set; }    
    
    /// <summary>
    /// 已使用额度
    /// </summary>
    public decimal UsedAmount { get; set; }    
    
    /// <summary>
    /// 申请中额度
    /// </summary>
    public decimal PendingAmount { get; set; }    
    
    /// <summary>
    /// 预警阈值
    /// </summary>
    public decimal WarningThreshold { get; set; }    
    
    /// <summary>
    /// 预算名称
    /// </summary>
    public string? BudgetName { get; set; }    
    
    /// <summary>
    /// 是否启用预警
    /// </summary>
    public bool IsWarningEnabled { get; set; }    
    
    /// <summary>
    /// 备注
    /// </summary>
    public string? Remark { get; set; }    
    
    /// <summary>
    /// 租户Id
    /// </summary>
    public long? TenantId { get; set; }    
    
    /// <summary>
    /// 软删除
    /// </summary>
    public bool IsDelete { get; set; }    
    
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }    
    
    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }    
    
    /// <summary>
    /// 创建者Id
    /// </summary>
    public long? CreateUserId { get; set; }    
    
    /// <summary>
    /// 创建者姓名
    /// </summary>
    public string? CreateUserName { get; set; }    
    
    /// <summary>
    /// 修改者Id
    /// </summary>
    public long? UpdateUserId { get; set; }    
    
    /// <summary>
    /// 修改者姓名
    /// </summary>
    public string? UpdateUserName { get; set; }    
    
}

/// <summary>
/// 区域预算配置表数据导入模板实体
/// </summary>
public class ExportStoreBudgetConfigOutput : ImportStoreBudgetConfigInput
{
    [ImporterHeader(IsIgnore = true)]
    [ExporterHeader(IsIgnore = true)]
    public override string Error { get; set; }
}

/// <summary>
/// 预算预警输出
/// </summary>
public class BudgetWarningOutput
{
    /// <summary>
    /// 预算配置ID
    /// </summary>
    public long BudgetId { get; set; }
    
    /// <summary>
    /// 预算名称
    /// </summary>
    public string? BudgetName { get; set; }
    
    /// <summary>
    /// 组织ID
    /// </summary>
    public long OrgsId { get; set; }
    
    /// <summary>
    /// 组织名称
    /// </summary>
    public string? OrgName { get; set; }
    
    /// <summary>
    /// 总预算额度
    /// </summary>
    public decimal TotalAmount { get; set; }
    
    /// <summary>
    /// 已使用额度
    /// </summary>
    public decimal UsedAmount { get; set; }
    
    /// <summary>
    /// 申请中额度
    /// </summary>
    public decimal PendingAmount { get; set; }
    
    /// <summary>
    /// 总使用额度（已使用+申请中）
    /// </summary>
    public decimal TotalUsed { get; set; }
    
    /// <summary>
    /// 使用率（百分比）
    /// </summary>
    public decimal UsageRate { get; set; }
    
    /// <summary>
    /// 预警阈值
    /// </summary>
    public decimal WarningThreshold { get; set; }
    
    /// <summary>
    /// 剩余额度
    /// </summary>
    public decimal RemainingAmount { get; set; }
    
    /// <summary>
    /// 预算开始时间
    /// </summary>
    public DateTime StartDate { get; set; }
    
    /// <summary>
    /// 预算结束时间
    /// </summary>
    public DateTime EndDate { get; set; }
}

/// <summary>
/// 预算汇总输出
/// </summary>
public class BudgetSummaryOutput
{
    /// <summary>
    /// 预算配置ID
    /// </summary>
    public long Id { get; set; }
    
    /// <summary>
    /// 预算名称
    /// </summary>
    public string? BudgetName { get; set; }
    
    /// <summary>
    /// 组织ID
    /// </summary>
    public long OrgsId { get; set; }
    
    /// <summary>
    /// 组织名称
    /// </summary>
    public string? OrgName { get; set; }
    
    /// <summary>
    /// 总预算额度
    /// </summary>
    public decimal TotalAmount { get; set; }
    
    /// <summary>
    /// 已使用额度
    /// </summary>
    public decimal UsedAmount { get; set; }
    
    /// <summary>
    /// 申请中额度
    /// </summary>
    public decimal PendingAmount { get; set; }
    
    /// <summary>
    /// 总使用额度（已使用+申请中）
    /// </summary>
    public decimal TotalUsed { get; set; }
    
    /// <summary>
    /// 使用率（百分比）
    /// </summary>
    public decimal UsageRate { get; set; }
    
    /// <summary>
    /// 剩余额度
    /// </summary>
    public decimal RemainingAmount { get; set; }
    
    /// <summary>
    /// 预警阈值
    /// </summary>
    public decimal WarningThreshold { get; set; }
    
    /// <summary>
    /// 是否启用预警
    /// </summary>
    public bool IsWarningEnabled { get; set; }
    
    /// <summary>
    /// 预算状态 (normal/warning/danger)
    /// </summary>
    public string Status { get; set; } = "normal";
    
    /// <summary>
    /// 预算开始时间
    /// </summary>
    public DateTime StartDate { get; set; }
    
    /// <summary>
    /// 预算结束时间
    /// </summary>
    public DateTime EndDate { get; set; }
}

/// <summary>
/// 预算总览汇总
/// </summary>
public class BudgetOverallSummary
{
    /// <summary>
    /// 总预算配置数量
    /// </summary>
    public int TotalBudgetCount { get; set; }
    
    /// <summary>
    /// 总预算额度
    /// </summary>
    public decimal TotalAmount { get; set; }
    
    /// <summary>
    /// 总已使用额度
    /// </summary>
    public decimal TotalUsed { get; set; }
    
    /// <summary>
    /// 总申请中额度
    /// </summary>
    public decimal TotalPending { get; set; }
    
    /// <summary>
    /// 总剩余额度
    /// </summary>
    public decimal TotalRemaining { get; set; }
    
    /// <summary>
    /// 整体使用率（百分比）
    /// </summary>
    public decimal OverallUsageRate { get; set; }
    
    /// <summary>
    /// 预警数量
    /// </summary>
    public int WarningCount { get; set; }
    
    /// <summary>
    /// 危险数量
    /// </summary>
    public int DangerCount { get; set; }
}

/// <summary>
/// 预算看板输出
/// </summary>
public class BudgetDashboardOutput
{
    /// <summary>
    /// 总览汇总
    /// </summary>
    public BudgetOverallSummary Summary { get; set; } = new();
    
    /// <summary>
    /// 预算详情列表
    /// </summary>
    public List<BudgetSummaryOutput> BudgetDetails { get; set; } = new();
    
    /// <summary>
    /// 最后更新时间
    /// </summary>
    public DateTime LastUpdateTime { get; set; }
    
    /// <summary>
    /// 查询日期
    /// </summary>
    public DateTime QueryDate { get; set; }
}

/// <summary>
/// 预算趋势输出
/// </summary>
public class BudgetTrendOutput
{
    /// <summary>
    /// 日期
    /// </summary>
    public DateTime Date { get; set; }
    
    /// <summary>
    /// 当日总使用额度
    /// </summary>
    public decimal TotalUsed { get; set; }
    
    /// <summary>
    /// 星期几
    /// </summary>
    public string DayOfWeek { get; set; } = "";
}

/// <summary>
/// 预算历史输出
/// </summary>
public class BudgetHistoryOutput
{
    /// <summary>
    /// 预算配置ID
    /// </summary>
    public long Id { get; set; }
    
    /// <summary>
    /// 预算名称
    /// </summary>
    public string? BudgetName { get; set; }
    
    /// <summary>
    /// 组织ID
    /// </summary>
    public long OrgsId { get; set; }
    
    /// <summary>
    /// 组织名称
    /// </summary>
    public string? OrgName { get; set; }
    
    /// <summary>
    /// 总预算额度
    /// </summary>
    public decimal TotalAmount { get; set; }
    
    /// <summary>
    /// 已使用额度
    /// </summary>
    public decimal UsedAmount { get; set; }
    
    /// <summary>
    /// 申请中额度
    /// </summary>
    public decimal PendingAmount { get; set; }
    
    /// <summary>
    /// 预算开始时间
    /// </summary>
    public DateTime StartDate { get; set; }
    
    /// <summary>
    /// 预算结束时间
    /// </summary>
    public DateTime EndDate { get; set; }
    
    /// <summary>
    /// 是否为当前活动预算
    /// </summary>
    public bool IsActive { get; set; }
    
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }
}

/// <summary>
/// 预算冲突检查输入
/// </summary>
public class CheckBudgetConflictInput
{
    /// <summary>
    /// 区域ID
    /// </summary>
    public long OrgsId { get; set; }
    
    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime StartDate { get; set; }
    
    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime EndDate { get; set; }
    
    /// <summary>
    /// 排除的配置ID（编辑时使用）
    /// </summary>
    public long? ExcludeId { get; set; }
}

/// <summary>
/// 预算冲突信息
/// </summary>
public class BudgetConflictInfo
{
    /// <summary>
    /// 配置ID
    /// </summary>
    public long Id { get; set; }
    
    /// <summary>
    /// 预算名称
    /// </summary>
    public string? BudgetName { get; set; }
    
    /// <summary>
    /// 组织名称
    /// </summary>
    public string? OrgName { get; set; }
    
    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime StartDate { get; set; }
    
    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime EndDate { get; set; }
    
    /// <summary>
    /// 预算金额
    /// </summary>
    public decimal TotalAmount { get; set; }
}

/// <summary>
/// 预算冲突检查输出
/// </summary>
public class BudgetConflictCheckOutput
{
    /// <summary>
    /// 是否存在冲突
    /// </summary>
    public bool HasConflicts { get; set; }
    
    /// <summary>
    /// 冲突数量
    /// </summary>
    public int ConflictCount { get; set; }
    
    /// <summary>
    /// 冲突详情
    /// </summary>
    public List<BudgetConflictInfo> Conflicts { get; set; } = new();
    
    /// <summary>
    /// 解决建议
    /// </summary>
    public List<string> Suggestions { get; set; } = new();
}
